﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;
using System.Collections;
using EAGL.Data;


namespace EAGL.Explore
{
    public class FeatureClassExplorer
    {

       #region ======================= protected =======================
        // deprecated functionality in this class, its functionality is now contained within FeatureCursorExplorer

        protected IFeatureClass featureClass;
        
        
        
        #endregion

        #region ======================= PUBLIC ==========================

        
        
        public FeatureClassExplorer(IFeatureClass featureClass)
        {
            this.featureClass = featureClass;
        }

        /// <summary>
        /// Rreturns a list of unique values of field(s) in a feature class
        /// </summary>
        /// <param name="fieldNames"></param>
        /// <returns>The return value is a list of object arrays that contains the unique values returned</returns>
        public List<object[]> GetUniqueValues(string[] fieldNames)
        {
           IFeatureCursor crsr = this.featureClass.Search(null, false);
           FeatureCursorExplorer fex = new FeatureCursorExplorer(crsr);
           return fex.GetUniqueValues(fieldNames);
        }

        
        /// <summary>
        /// Rreturns a list of unique values of one field in a feature class
        /// </summary>
        /// <param name="fieldName"></param>
        /// <returns>Simpler version that handles one field name</returns>
        public List<string> GetUniqueValues(string fieldName)
        {
            IFeatureCursor crsr = this.featureClass.Search(null, false);
            FeatureCursorExplorer fex = new FeatureCursorExplorer(crsr);
            return fex.GetUniqueValues(fieldName);
        }


        /// <summary>
        /// Rreturns a list of unique values of one field in a feature class (Another method, needs benchmarking).
        /// </summary>
        /// <param name="fieldName"></param>
        /// <returns>Simpler version that handles one field name</returns>
        public List<string> GetUniqueValues2(string fieldName)
        {
            IFeatureCursor crsr = this.featureClass.Search(null, false);
            FeatureCursorExplorer fex = new FeatureCursorExplorer(crsr);
            return fex.GetUniqueValues2(fieldName);
        }
        
        #endregion



        
    }
}
